/* 
 * File:   cursor.h
 * Author: cow
 *
 * Created on March 4, 2011, 12:26 PM
 */

#ifndef _CURSOR_H
#define	_CURSOR_H

//includes-----------------------------
//signals---------------------
#include <sigc++/sigc++.h>
#include <sigc++/connection.h>

//defines------------------------------
namespace Cursor{
#define cursEnter sigc::signal<void, int , int>
#define cursMove  sigc::signal<void, int , int>
}
//prototypes---------------------------
namespace Cursor{
class cursorListener;
class cursorServer;
}
//definitions--------------------------
namespace Cursor{
class cursorListener : public sigc::trackable{
    friend class cursorServer;
    protected:
        virtual void signal_curs_enter(int x, int y) = 0;
        virtual void signal_curs_move(int x, int y) = 0;
        sigc::connection enterConnect;
        sigc::connection moveConnect;
};

class cursorServer{
    public:
        //constructs
        cursorServer();
        ~cursorServer();
        //cursor handlers
        virtual void moveCursor(int x, int y);
        virtual void selectCursor();
        virtual void requestCursorCoords(int* x, int* y);
        //signal connectors
        virtual void requestCursorEnter(cursorListener* lst);
        virtual void requestCursorMove(cursorListener* lst);
    protected:
        //cursor location
        int cursor[2];
        //signals
        cursEnter signalClick;
        cursMove signalMove;
};
}
#endif	/* _CURSOR_H */

